{{--提交按钮组件--}}
<div class="layui-form-item" style="position: fixed;background: #fff;box-shadow: 0 1px 5px 0 rgba(0,0,0,0.5);width: 100%;padding: 10px 0;margin: 0;left: 0; bottom: 0;text-align: center;">
    <button class="layui-btn" lay-submit="" id="{{$id??'send'}}" lay-filter="component-form-element">{{ $label??'立即提交' }}</button>
    <button class="layui-btn layui-btn-primary" type="button" id="cancel">取消返回</button>
</div>

@section('js')
    @parent
    <script>
        layui.use(['jquery'], function () {
            var $ = layui.$;
            //表单改为ajax提交
            $("#{{$form??'form'}}").on('submit', function(e){
                e.preventDefault();

                var formData = $("#{{$form??'form'}}").serialize();

                $.post('{{$action??''}}',formData,function(data){
                    layer.alert(data.msg,function(index){
                        if (data.code == 0){
                            @if(isset($reload))
                                {!! $reload !!}
                            @else
                                parent.layui.table.reload('model');
                            @endif

                            parent.layer.closeAll();
                        }
                        layer.close(index);
                    });
                },'json');
            });

            $('#cancel').click(function(){
                parent.layer.closeAll();
            })
        })
    </script>
@endsection